<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" charset="utf-8"></script> -->
<script type="text/javascript" src="nagging-menu.js" charset="utf-8"></script>
<script>
$(function(){
	//show effect of menu bar when scroll below the top - ThanhLD1
	var menu = $('#menu'),
		pos = menu.offset();

		$(window).scroll(function(){
			if($(this).scrollTop() > pos.top+menu.height() && menu.hasClass('default')){
				menu.fadeOut('fast', function(){
					$(this).removeClass('default').addClass('fixed').fadeIn('fast');
				});
			} else if($(this).scrollTop() <= pos.top && menu.hasClass('fixed')){
				menu.fadeOut('fast', function(){
					$(this).removeClass('fixed').addClass('default').fadeIn('fast');
				});
			}
		});

});</script>
<style type="text/css">
body {
  padding-top: 20px;
  padding-bottom: 20px;
}

.navbar {
  margin-bottom: 20px;
}
.dropdown-menu li{
  margin-bottom: 10px;
}
#header {
 /*  margin-left: 70px;
  margin-right: 70px; */
    width:1100px;
    height:50px;
    display:block;
    position:fixed;
    top:1;
    left:1;
}
.navbar-inverse {
  background-color: #EEEEE6;
  border-color: #9B7188;
}

.default {
	width: 1100px;
	height: 51px;
}

.fixed {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 51px;
	float: center;
	 z-index: 1000; 
}

.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
  color: #fff;
  background-color: #9B7188;
}
.navbar-inverse .navbar-nav > .inactive > a:hover{
  color: #fff;
  background-color: #9B7188;
}
.navbar-inverse .navbar-nav > li > a {
  color: #9B7188;
}

.navbar-inverse .navbar-nav > li > a:hover{
color: #EEEEE6;
  background-color: #9B7188;
}


.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus {
color: #fff;
background-color: #9B7188;
}
.dropdown-menu > li > a {
  color: #9B7188;
}
.dropdown-menu > li > a:hover,  .dropdown-menu > li > a:focus{
  color: #fff;
  background-color: #9B7188;
}
</style>
<div id="navi">
	<div id="menu" class="navbar navbar-inverse col-md-12 default" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse"
					data-target=".navbar-collapse">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="/">Sample blog</a>
			</div>
			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav">
					<li class="active"><a href="/">Home</a></li>
				</ul>
				<ul class="nav navbar-nav navbar-right">
	          	<?php
												if ($this->Session->check ( "AdminLogin" )) {
													$admin = $this->Session->read ( "AdminLogin" );
													?> 
						<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown"><?php echo $admin['Admin']['Fullname'];?><span class="caret"></span></a>
						<ul class="dropdown-menu" >
							<li><a href="/admins/add">Add new post</a></li>
							<li><a href="/admins/manageclick/<?php echo $admin['Admin']['AdminID'];?>">Manage</a></li>
							<li class="divider"></li>
							<li><a href="/login/logout">Logout</a></li>
						</ul></li>
				<?php
												} else {
													echo "<li><a href='/login/login'>Login</a></li>";
													echo "<li><a href='/register/register'>Register</a></li>";
												}
												?>
							<li>
						<form class="navbar-form navbar-left" role="search"
							action="/search/searchtitle" method="post">
							<div class="form-group">
								<?php
									if($this->Session->check('SearchCondition')){
										$searchCondition = $this->Session->read('SearchCondition');
									}else{
										$searchCondition = "";
									}
								?>
								<input name="txtSearchCondition" type="text"
									class="form-control" placeholder="Search blog title" value="<?php echo $searchCondition;?>" required>
							</div>
							
							
							<div class="btn-group">
							  <button type="submit" class="btn btn-default">
								<span class=" glyphicon glyphicon-search"></span>
							  </button>
							  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
							    <span class="caret"></span>
							  </button>
							  <ul class="dropdown-menu" role="menu">
							    <li><a href="/search/advance">Advance search</a></li>
							  </ul>
							</div>
						</form>
					</li>
				</ul>

			</div>
		</div>

	</div>
</div>
